home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xcmd / xrulesde.sit / Xrules™ Tutorial / card_16206.txt < prev    next >
Encoding:
Text File  |  1991-06-24  |  2.4 KB  |  49 lines

  1. -- card: 16206 from stack: in
  2. -- bmap block id: 18400
  3. -- flags: 4000
  4. -- background id: 7050
  5. -- name: fact declarations
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0007
  11. -- rect: left=2 top=26 right=314 bottom=511
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 22
  16. -- text size: 10
  17. -- style flags: 0
  18. -- line height: 13
  19. -- part name: doc
  20.  
  21.  
  22. -- part contents for card part 1
  23. ----- text -----
  24.   -- the rule base
  25.     global declarations
  26.     FACT DECLARATIONS
  27.     assignments
  28.     rules
  29.  
  30. To assign queries to facts in the rule base you must use the "fact" keyword.  This keyword should appear after the "global" statement if globals are used.  Otherwise, it should be the first keyword in the rule base.  You then enter the facts followed by their queries.  The queries may be simple or quoted strings and facts must be separated by commas (fact names must be in quotes if they contain spaces or special characters or if they match keywords).  The syntax is as follows:
  31.  
  32.     fact_declarations  :=  FACT fact_id query  {, fact_id query} 
  33.  
  34. When the system needs a fact, it will display the query string in the query field on the "tutorial shell" card.
  35.  
  36. The fact declaration section also allows you to control the order of queries while the system is forward chaining.  Facts that will not result in a user query (facts set only by rules or daemons) should not appear in the fact declaration section.
  37.  
  38. For example, if you wanted the inference engine to examine facts "a", "b", "c", and "the thing" in the order "a", "c", "the thing", and "b" you would declare the facts as follows:
  39.  
  40.   fact a "ask about a", 
  41.        c "ask about c", 
  42.        "the thing" "ask about the thing",
  43.        b "ask about b"
  44.  
  45. In the above example, the forward chaining inference engine would first ask the user about fact "a", then "c", then "the thing", and finally, "b" if it did not already know the state of these facts.  Fact declarations do not affect the order of queries when backward chaining. 
  46.  
  47. Fact identifiers follow the conventions for HyperCard card identifiers. Identifiers may contain spaces or special characters or they may match keywords if they are enclosed in quotation marks.  You may also enclose fact names without spaces or special characters in quotation marks, but it is not necessary unless the name matches one of the keywords.  Fact identifiers may not match global names.
  48.  
  49.